﻿

using Elastic.Clients.Elasticsearch.IndexManagement;
using Elastic.Clients.Elasticsearch.Mapping;

namespace Cordyceps.Elasticsearch.Tool.Options;

/// <summary>
/// 索引定义，用于创建或更新索引
/// </summary>
/// <typeparam name="T">索引文档类型</typeparam>
public class IndexDefinition<T> where T : class
{
    /// <summary>
    /// 索引名称
    /// </summary>
    public string IndexName { get; set; } = string.Empty;
    
    /// <summary>
    /// 索引设置
    /// </summary>
    public IndexSettings? Settings { get; set; }
    
    /// <summary>
    /// 映射定义
    /// </summary>
    public TypeMapping? Mapping { get; set; }
    
    /// <summary>
    /// 别名列表
    /// </summary>
    public List<string>? Aliases { get; set; }
    
    /// <summary>
    /// 分片数（默认1）
    /// </summary>
    public int NumberOfShards { get; set; } = 1;
    
    /// <summary>
    /// 副本数（默认1）
    /// </summary>
    public int NumberOfReplicas { get; set; } = 1;
}